package me.zhengjie.modules.finace_taxation.rest;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.finace_taxation.domain.FtSearchVo;
import me.zhengjie.modules.finace_taxation.service.FtServiceTypeService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
* @author 杨荣森
* @date 2021-06-28
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "搜索管理")
@RequestMapping("/api/ft/ftIndex")
public class FtIndexController {

    private final FtServiceTypeService ftServiceTypeService;

    /**
     * 根据关键字搜索
     * @param map
     * @return
     */
    @PostMapping("/search")
    @Log("根据关键字搜索")
    @ApiOperation("根据关键字搜索")
    public JSONObject searchByKeyWords(@RequestBody Map<String, Object> map){
        JSONObject resObj = new JSONObject();
        List<FtSearchVo> searchVoList = ftServiceTypeService.searchByKeyWords(map);
        resObj.put("searchList", searchVoList);
        resObj.put("message", "查询成功! ");
        resObj.put("code", 200);
        resObj.put("success", true);
        return resObj;
    }

}
